package gptma.bo.state;

public class ClientRequestStateEngineKey {

	private String lastState;

	private String currentState;

	public ClientRequestStateEngineKey(String lastState, String currentState) {
		if (lastState != null) {
			this.lastState = lastState.replace("\r", "");
		}

		if (currentState != null) {
			this.currentState = currentState.replace("\r", "");
		}
	}

	/**
	 * @return the lastState
	 */
	public String getLastState() {
		return lastState;
	}

	/**
	 * @return the currentState
	 */
	public String getCurrentState() {
		return currentState;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((currentState == null) ? 0 : currentState.hashCode());
		result = prime * result
				+ ((lastState == null) ? 0 : lastState.hashCode());
		return result;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final ClientRequestStateEngineKey other = (ClientRequestStateEngineKey) obj;
		if (currentState == null) {
			if (other.currentState != null)
				return false;
		} else if (!currentState.equals(other.currentState))
			return false;
		if (lastState == null) {
			if (other.lastState != null)
				return false;
		} else if (!lastState.equals(other.lastState))
			return false;
		return true;
	}

}
